<template>
  <div class="goods">
    <h2>{{pname}}</h2>
     <p>{{info}}</p>
     <p>单价：{{price}}</p>
     <button @click="$emit('kanyidao',2,id)">砍一刀</button>
  </div>
</template>

<script>
export default {
  props:{
    id: {
    type: Number, // id的类型必须是数字类型
    required: true, // 父组件必须传递id
  },
  pname: {
   default:'蛋糕',
   type:String 
  },
  price:Number,
  info: {
 required: true,
 type:[Number,String]
  },}
}
</script>

<style>
.goods{
  padding:5px;
  margin: 10px;
  border: solid 2px black;
}
</style>